#include <stdio.h>
#include "tlvparse.h"


int main()
{
	unsigned char buf2[] = {
        0x6F,0x22,0x84,0x0E,0x31,0x50,0x41,0x59,0x2E,0x53,0x59,0x53,
        0x2E,0x44,0x44,0x46,0x30,0x31,0xA5,0x10,0x88,0x01,0x01,0x5F,
        0x2D,0x02,0x7A,0x68,0xBF,0x0C,0x05,0x9F,0x4D,0x02,0x0B,0x0A
	};

	unsigned char buf3[] = {
		0x70,0x1C,0x61,0x1A,0x4F,0x08,0xA0,0x00,0x00,0x03,0x33,0x01,
		0x01,0x02,0x50,0x0B,0x50,0x42,0x4F,0x43,0x20,0x43,0x52,0x45,
		0x44,0x49,0x54,0x87,0x01,0x01
	};


	//parse 1
	struct TLVNode* node = TLV_Parse(buf2,sizeof(buf2));
	TLV_Debug(node);

	//parse 2
	struct TLVNode* node2 = TLV_Parse(buf3,sizeof(buf3));
	TLV_Debug(node2);

	TLV_Merge(node,node2);
	TLV_Free(node2);

	struct TLVNode* found = TLV_Find(node,0x9f4d);
	if(found)
	{
		printf("FOUND! 9f4d\n");
	}
	else
	{
		printf("NOT FOUND! 9f4d\n");
	}

	found = TLV_Find(node,0x4f);
	if(found)
	{
		printf("FOUND! 4f\n");
	}
	else
	{
		printf("NOT FOUND! 4f\n");
	}
	return 0;
}
